﻿<?php //Seyret Component v.0.3//
/**
* @package Seyret
* @version 0.3
* @copyright Copyright (C) 2008 Mustafa DINDAR. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Seyret Video Component is a free software.
* See seyrettos.html for license notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

require_once( JPATH_SITE.DS.'components'.DS.'com_seyret'.DS.'includes'.DS.'classes'.DS.'usertools.class.php' );
$usertool = new usertools();

$session =& JFactory::getSession();
$seyretmessagetype=$session->get('seyret.messagetype');
$seyretmessage=$this->seyretmessage($seyretmessagetype);
$session->clear('seyret.messagetype');


$user =& JFactory::getUser();
$comments=$this->comments;


$avatarsystem = $this->registry->getValue( 'seyret.user.avatarsystem');


?>



<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery.seyrettools.deletecommentlink();
		jQuery.seyrettools.paginationlinks();
	});

</script>	


	<div id="commentstitle" style="margin-bottom:10px;"><?php echo JText::_('Comments');?>  </div>

	
	<div class="commentspaginator"><?php echo $this->compageNav;?> 
		<div style="float:right;"><?php echo $this->totalcommentscount; ?> comments</div>
	</div>


<?php

$row = "1";
foreach ($comments as $comment) {
	
?>


	<div id="comment<?php echo $comment->id;?>" class="seyretcomment commentsrow<?php echo $row;?>">
		<div style="float:right; margin:3px;"><?php echo $usertool->getUserAvatar($comment->userid, $comment->authoremail, "40", $avatarsystem); ?>
			
		</div>
		<div class="seyretcommenttitle"><?php echo $comment->commenttitle;?></div>
		
		
		
		
		<div class=""><?php echo $comment->commentbody;?></div>
		
		<div class="seyretcommentactions">
			<div style="float:right;">
			<?php
			// edit comment link ---------------------
			if ($this->registry->getValue('permission.access.caneditallcomments') == "1" OR ($this->registry->getValue('permission.access.caneditowncomments') == "1") AND $comment->userid == $user->id ) {
			?>
			<a href="index.php?option=com_seyret&amp;view=comments&amp;task=geteditoredit&amp;comid=<?php echo $comment->id;?>&amp;tmpl=component&amp;iframe=true&amp;width=600&amp;height=490" rel="editcommentlink" class="editcommentlink " title="<?php echo JText::_('Edit Comment');?>"><img alt="<?php echo JText::_('Edit Comment');?>" src="<?php echo JURI :: root(); ?>components/com_seyret/themes/default/images/editcomment.png"/></a> 
			
			
			<?php
			
			}
			// ----------------------------------------
			
			?>


			<?php
			
			// delete comment link ---------------------
			if ($this->registry->getValue('permission.access.candeleteallcomments') == "1" OR ($this->registry->getValue('permission.access.candeleteowncomments') == "1") AND $comment->userid == $user->id ) {
			?>
			<a href="" rel="<?php echo $comment->id;?>"  class="deletecommentlink " title="<?php echo JText::_('Delete Comment');?>"><img alt="<?php echo JText::_('Delete Comment');?>" src="<?php echo JURI :: root(); ?>components/com_seyret/themes/default/images/deletecomment.png"/></a> 
			
			
			<?php
			
			}
			
			?>

			
			<?php
			

			if ($this->registry->getValue('permission.access.canreportcomments') == "1") {
			?>
			<a href="index.php?option=com_seyret&amp;view=tools&amp;task=flagcomment&amp;comid=<?php echo $comment->id;?>&amp;tmpl=component&amp;iframe=true&amp;width=600&amp;height=490&title=<?php echo urlencode($comment->commenttitle);?>" rel="reportcommentlink" class="reportcommentlink " title="<?php echo JText::_('Report Comment');?>"><img alt="<?php echo JText::_('Report Comment');?>" src="<?php echo JURI :: root(); ?>components/com_seyret/themes/default/images/flagcomment.png"/></a> 
			
			
			<?php
			
			}
			
			?>
			
			
			
			<img alt="" src="<?php echo JURI :: root(); ?>components/com_seyret/themes/default/images/thumbsup.png"/>
			
			<img alt="" src="<?php echo JURI :: root(); ?>components/com_seyret/themes/default/images/thumbsdown.png"/>
			
			</div>



			
			<div style="text-align:center !important; font-weight:bold; float:left;"><?php echo JText::_('Written by');?> : <?php echo $comment->authorname;?></div>
			
			<div style="text-align:center !important; font-weight:bold; float:left; margin-left:10px;">
			<?php
			

			if ($this->registry->getValue('permission.access.canseecommentips') == "1" ) {
				echo $comment->authorip;			
			}
			
			?>		

			</div>			
			
		
			
		</div>
		
	</div>

	

<?php 

	if ($row == "1") {
		$row = "2";
	} else {
		$row = "1";
	}
}



?>
	<div class="commentspaginator"><?php echo JText::_('Page');?>: <?php echo $this->compageNav;?></div>